home *** CD-ROM | disk | FTP | other *** search
/ 10,000 Great Games / 10,000 Great Games.iso / Product / 66 / data1.cab / Source_Files / Src / QuickStart.cpp < prev    next >
C/C++ Source or Header  |  2000-01-16  |  2KB  |  83 lines

  1. #include "stdafx.h"
  2.  
  3. #include "PlayerSelect.h"
  4. #include "QuickStart.h"
  5.  
  6. int started_with_quickstart = FALSE;
  7. char quickstart_level[_MAX_FNAME] = "demo";
  8.  
  9. CQuickStart::CQuickStart(CWnd* pParent)
  10.     : CDialog(CQuickStart::IDD, pParent)
  11. {
  12.     //{{AFX_DATA_INIT(CQuickStart)
  13.     //}}AFX_DATA_INIT
  14. }
  15.  
  16. void CQuickStart::DoDataExchange(CDataExchange* pDX)
  17. {
  18.     CDialog::DoDataExchange(pDX);
  19.     //{{AFX_DATA_MAP(CQuickStart)
  20.     DDX_Control(pDX, IDC_QS_LEVEL, m_Level);
  21.     //}}AFX_DATA_MAP
  22. }
  23.  
  24. BEGIN_MESSAGE_MAP(CQuickStart, CDialog)
  25.     //{{AFX_MSG_MAP(CQuickStart)
  26.     ON_BN_CLICKED(ID_QS_SELECT, OnSelect)
  27.     ON_BN_CLICKED(ID_QS_EXIT, OnExit)
  28.     ON_WM_DESTROY()
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.  
  32. void CQuickStart::OnSelect() 
  33. {
  34.     CPlayerSelect p;
  35.     p.DoModal();        
  36. }
  37.  
  38. void CQuickStart::OnOK()
  39. {
  40.     started_with_quickstart = TRUE;
  41.  
  42.     mainwindow->PostMessage(WM_COMMAND, ID_RUN_LEVEL, 0);
  43.  
  44.     CDialog::OnOK();
  45. }
  46.  
  47. void CQuickStart::OnExit() 
  48. {
  49.     mainwindow->PostMessage(WM_CLOSE, 0, 0);
  50. }
  51.  
  52. BOOL CQuickStart::OnInitDialog() 
  53. {
  54.     CDialog::OnInitDialog();
  55.  
  56.     // Add levels to combobox
  57.  
  58.     CFileFind files;
  59.     BOOL ok = files.FindFile("*.bdl");
  60.  
  61.     while (ok)
  62.     {
  63.         ok = files.FindNextFile();
  64.         m_Level.AddString(files.GetFileTitle());
  65.     }
  66.  
  67.     // Select one
  68.  
  69.     m_Level.SelectString(0, quickstart_level);
  70.  
  71.     if (m_Level.GetCurSel() == -1)
  72.         m_Level.SetCurSel(0);
  73.  
  74.     return TRUE;
  75. }
  76.  
  77. void CQuickStart::OnDestroy() 
  78. {
  79.     CDialog::OnDestroy();
  80.     
  81.     m_Level.GetLBText(m_Level.GetCurSel(), quickstart_level);
  82. }
  83.